package com.insigma.business.qrcode.common.vo;


import com.insigma.business.qrcode.common.util.ErrorContext;

public class BaseResponse<T> extends ToString {
    private static final long serialVersionUID = 1L;
    private boolean success;
    private ErrorContext errorCtx;
    private T dto;

    public BaseResponse() {
    }

    public BaseResponse(boolean success) {
        this.success = success;
    }

    public BaseResponse(boolean success, T dto) {
        this.success = success;
        this.dto = dto;
    }

    public BaseResponse(boolean success, String errorCode, String errorMsg) {
        this.success = success;
        this.errorCtx = new ErrorContext(errorCode, errorMsg);
    }

    public BaseResponse(boolean success, String productionAppName, String scenarioCode, String errorCode, String errorMsg) {
        this.success = success;
        this.errorCtx = new ErrorContext(productionAppName, scenarioCode, errorCode, errorMsg);
    }

    public boolean isSuccess() {
        return this.success;
    }

    public ErrorContext getErrorCtx() {
        return this.errorCtx;
    }

    public T getDto() {
        return this.dto;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }
    public boolean getSuccess() {
        return this.success;
    }

    public void setErrorCtx(ErrorContext errorCtx) {
        this.errorCtx = errorCtx;
    }

    public void setDto(T dto) {
        this.dto = dto;
    }
}
